package cn.cool.domain.trade.model.valobj;

import cn.cool.types.exception.AppException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum TradeOrderStatusEnumVO {
    CREATE(0, "初始创建"),
    COMPLETE(1, "消费完成"),
    CLOSE(2, "超时关单"),;

    private Integer code;
    private String info;

    public static TradeOrderStatusEnumVO valueOf(Integer code) {
        for (TradeOrderStatusEnumVO value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        throw new AppException("枚举查找异常！");
    }
}
